Hi, i am using the below code to change the name an excel file that is obtained after exporting a module in DOORS. As the file is always created under the name Workbook 1, i want to change its name with the module's original name.
void createExcelFile(OleAutoObj objExcel, string filename)
{
OleAutoObj objWB
OleAutoObj objWBs
OleAutoArgs autoArgs = create
Module modselektor = current
filename = name(modselektor)
olePut(objExcel,"Visible",true) // Actually i do not need this as my excel is already made visible
oleGet(objExcel,"Workbooks", objWBs)
put (autoArgs,1) // Create new workbook
oleMethod(objWBs,"Add",autoArgs,objWB)
clear autoArgs
put(autoArgs,filename"")
oleMethod(objWB,"SaveAs",autoArgs)
print "i have saved it!"
objWBs = null
delete autoArgs
if(!null objWB)
{
objWB = null
return true
}
else
objWB = null
olePut(objExcel,"DisplayAlerts",true)
}
SystemAdmin - Wed Apr 22 08:04:47 EDT 2009 |
Re: changing the name of an excel file |
Re: changing the name of an excel file |
Re: changing the name of an excel file SystemAdmin - Wed Apr 22 09:04:49 EDT 2009
Hi again i figured out that it would be a little bit difficult for everyone to see what i am doing so i decided to show a part my code where i implemented this algorithme:
// Get active workbook
oleResult( oleGet( objExcelApplication, cExcelPropertyActiveWorkbook, objExcelWorkbook ) )
Module modselektor = current
string filename = name(modselektor)
// print "i try to change the file's name with this name\n" filename "\n"
OleAutoObj objExcelSheet
OleAutoArgs AutoArgs = create
put(AutoArgs,filename "")
oleMethod(objExcelWorkbook,"Name",AutoArgs)
delete AutoArgs
if ( null objExcelWorkbook ) {
if ( runInteractive ) errorBox errorCannotGetActiveWorkbook
return false
}
|
Re: changing the name of an excel file SystemAdmin - Wed Apr 22 11:22:12 EDT 2009
Hi again i figured out that it would be a little bit difficult for everyone to see what i am doing so i decided to show a part my code where i implemented this algorithme:
// Get active workbook
oleResult( oleGet( objExcelApplication, cExcelPropertyActiveWorkbook, objExcelWorkbook ) )
Module modselektor = current
string filename = name(modselektor)
// print "i try to change the file's name with this name\n" filename "\n"
OleAutoObj objExcelSheet
OleAutoArgs AutoArgs = create
put(AutoArgs,filename "")
oleMethod(objExcelWorkbook,"Name",AutoArgs)
delete AutoArgs
if ( null objExcelWorkbook ) {
if ( runInteractive ) errorBox errorCannotGetActiveWorkbook
return false
}
|
Re: changing the name of an excel file SystemAdmin - Fri Apr 24 08:58:56 EDT 2009 I have the same issue. What did you do to name an excel file that had been exported? |
Re: changing the name of an excel file patrickc3000 - Mon Mar 21 17:54:31 EDT 2011 See here Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |